/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package menudesktop;

import java.awt.GridLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JToolBar;

/**
 *
 * @author GoLiATh
 */
public class PanelBarOpciones extends JPanel implements ActionListener{
    private JButton botonMenu;
    private JButton botonPedidos;
    private JButton botonProducto;
    private JButton botonPlato;
    private JButton botonMapa;
    private JButton botonInformes;
    private Ventana ventana;
            
    public PanelBarOpciones(Ventana ventana) {
        this.ventana = ventana;
        this.setLayout(new GridLayout(6,1));
        
        ImageIcon iconBoton1 = new ImageIcon("src/Resource/menu.JPG");
        
        int ancho = 70; // ancho en pixeles que tendra el icono escalado
        int alto = -1; // alto (para que conserve la proporcion pasamos -1)

        // Obtiene un icono en escala con las dimensiones especificadas
        ImageIcon iconBoton11 = new ImageIcon(iconBoton1.getImage().getScaledInstance(ancho, alto,Image.SCALE_DEFAULT));
        
        ImageIcon iconBoton2 = new ImageIcon("src/Resource/menulisto.JPG");
        ImageIcon iconBoton3 = new ImageIcon("src/Resource/despachado.JPG");
        ImageIcon iconBoton4 = new ImageIcon("src/Resource/iconoPlatos.PNG");
        ImageIcon iconBoton5 = new ImageIcon("src/Resource/icono_mapa_1.PNG");
        
        this.botonMenu = new JButton();
        this.botonMenu.setIcon(iconBoton11);
        this.botonMenu.setBorder(null);
        
        this.botonPedidos = new JButton();
        this.botonPedidos.setIcon(iconBoton2);
        this.botonPedidos.setBorder(null);
        
        this.botonProducto = new JButton();
        this.botonProducto.setIcon(iconBoton3);
        this.botonProducto.setBorder(null);
        
        this.botonPlato = new JButton();
        this.botonPlato.setIcon(iconBoton4);
        this.botonPlato.setBorder(null);
        
        this.botonMapa = new JButton();
        this.botonMapa.setIcon(iconBoton5);
        this.botonMapa.setBorder(null);
        
        this.botonInformes = new JButton("Informes");
        
        
        this.botonMenu.addActionListener(this);
        this.botonMapa.addActionListener(this);
        this.botonPedidos.addActionListener(this);
        this.botonProducto.addActionListener(this);
        this.botonPlato.addActionListener(this);
        this.botonInformes.addActionListener(this);
        
        this.add(botonMapa);
        this.add(botonPlato);
        this.add(botonProducto);
        this.add(botonMenu);
        this.add(botonPedidos);
        this.add(botonInformes);
        
        
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if(e.getSource()==this.botonMenu){
        
            
            this.ventana.cambiarAPaneluno();
            
        }
        if (e.getSource()==this.botonMapa)
        {
            this.ventana.cambiarAPanelMapa();
        }
        if(e.getSource()==this.botonPedidos){
            
//           this.boton1.setEnabled(true);
//           this.boton3.setEnabled(true);
//           this.boton4.setEnabled(true);
//           this.boton2.setEnabled(false);
            
           this.ventana.cambiarAPaneldos();
        }
        if(e.getSource()==this.botonProducto){
            
//           this.boton1.setEnabled(true);
//           this.boton2.setEnabled(true);
//           this.boton4.setEnabled(true);
//           this.boton3.setEnabled(false);
            
            this.ventana.cambiarAPaneltres();
        }
        if(e.getSource()==this.botonPlato){
            
//           this.boton1.setEnabled(true);
//           this.boton2.setEnabled(true);
//           this.boton4.setEnabled(true);
//           this.boton4.setEnabled(false);
            
            this.ventana.cambiarAPanelcuatro();
        }
        
        if (e.getSource() == this.botonInformes)
        {
            this.ventana.cambiarAPanelCinco();
        }
    }
    
    
}
